package com.webbei.Backstage.action;

import java.io.IOException;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;

public class checkProductNameAction {
			private String productName;
			private BackstateSer bao;

			public String execute(){
				System.out.println("productName:"+productName);
				int i=bao.checkProductName(productName);
				if(i==0){
					try {
						ServletActionContext.getResponse().getWriter().write("no");
						ServletActionContext.getResponse().setContentType("text/html");
					} catch (IOException e) {
						e.printStackTrace();
					}
				}else{
					try {
						ServletActionContext.getResponse().getWriter().write("yes");
						ServletActionContext.getResponse().setContentType("text/html");
					} catch (IOException e) {
						e.printStackTrace();
					}
					
				}
					return null;
			}
			public String getProductName() {
				return productName;
			}

			public void setProductName(String productName) {
				this.productName = productName;
			}

			public BackstateSer getBao() {
				return bao;
			}

			public void setBao(BackstateSer bao) {
				this.bao = bao;
			}
}
